<template>
  <div>
    <Header />
    <div class="login-container">
      <!-- 注册内容 -->
      <div class="login">
        <h3>华为账号登录</h3>
        <div class="wrap">
          <div class="box1">
            <div class="bgc">
              <div class="img">
                <img src="./images/QRcode.png" alt="" />
              </div>
            </div>
            <div class="text">
              若您使用华为手机，请前往“设置”>“华为帐号”扫码登录。
            </div>
          </div>
          <div class="box2"></div>
          <ValidationObserver v-slot="{ handleSubmit }" class="box3">
            <form @submit.prevent="handleSubmit(submit)">
              <!-- 手机号 -->
              <ValidationProvider
                class="content"
                name="phone"
                rules="phone|phoneRequired"
                mode="lazy"
                tag="div"
                v-slot="{ errors }"
              >
                <input
                  type="text"
                  placeholder="手机号/邮箱地址/账号名"
                  v-model="user.phone"
                />
                <span class="error-msg">{{ errors[0] }}</span>
              </ValidationProvider>

              <!-- 密码 -->
              <ValidationProvider
                class="content"
                name="password"
                rules="password|passwordRequired"
                mode="lazy"
                tag="div"
                v-slot="{ errors }"
              >
                <input type="text" placeholder="密码" v-model="user.password" />
                <span class="error-msg">{{ errors[0] }}</span>
              </ValidationProvider>
              <div class="code"><a>短信验证码登录</a></div>

              <div class="btn">
                <button>登录</button>
              </div>
            </form>

            <ul>
              <li><a href="/register">注册</a></li>
              <li><a href="#">忘记密码</a></li>
              <li class="last-border"><a href="#">遇到问题</a></li>
            </ul>
            <div class="icon">
              <span class="iconfont icon-QQ iconstyle"></span
              ><span class="iconfont icon-zhifubaozhifu iconstyle"></span
              ><span class="iconfont icon-weixin iconstyle"></span>
            </div>
          </ValidationObserver>
        </div>
      </div>
    </div>
    <Footer />
  </div>
</template>

<script>
import { mapActions } from "vuex";
import Header from "@/components/Header-lgreg";
import Footer from "@/components/Footer-lgreg";
import { ValidationObserver, ValidationProvider } from "vee-validate";
import "@/utils/http/regs";
export default {
  name: "Register",
  components: {
    Header,
    Footer,
    ValidationObserver,
    ValidationProvider,
  },
  data() {
    return {
      user: {
        phone: "",
        password: "",
      },
    };
  },
  methods: {
    ...mapActions("user", ["login"]),
    async submit() {
      await this.login(this.user);
      this.$router.push("/");
    },
  },
};
</script>

<style lang="less" scoped>
.login-container {
  .login {
    width: 1200px;
    height: 445px;
    margin: 0 auto;

    h3 {
      color: #333;
      text-align: center;
      margin-top: 75px;
      font-size: 25.6px;
    }
    .wrap {
      position: relative;
      height: 347;
      width: 550px;
      margin: 0 auto;
      .box1 {
        float: left;
        width: 300px;
        margin: 80px 0;
        text-align: center;
        .bgc {
          width: 150px;
          height: 150px;
          background: #f7f7f7;
          position: relative;
          .img {
            // text-align: center;
            position: absolute;
            top: 10px;
            left: 10px;
          }
        }
        .text {
          color: #00000099;
          font-size: 12px;
          margin-top: 40px;
          padding-right: -100px;
          position: relative;
          left: -70px;
        }
      }
      .box2 {
        position: relative;
        width: 1px;
        height: 240px;
        background: #f1f1f1;
        left: 277px;
        top: 73px;
      }
      .box3 {
        position: absolute;
        float: left;
        width: 300px;
        margin: 80px 0;
        right: -80px;
        top: -10px;
        .content {
          margin-bottom: 18px;
          // position: relative;
          input {
            width: 288px;
            height: 40.39px;
            padding-left: 8px;
            box-sizing: border-box;
            margin-left: 5px;
            outline: none;
            background: #f1f1f1;
            opacity: 0.5;
            border-radius: 5px;
          }
        }
        .code {
          color: #007ddd;
          font-size: 12px;
          margin-bottom: 28px;
          padding-left: 6px;
          a:hover {
            color: blue;
            cursor: pointer;
          }
        }
        .btn {
          text-align: center;
          line-height: 36px;
          margin-bottom: 15px;

          button {
            outline: none;
            width: 288px;
            height: 40.39px;
            background: #e1251b;
            opacity: 0.5;
            color: #fff !important;
            display: inline-block;
            font-size: 16px;
            border-radius: 5px;
          }
        }
        ul {
          text-align: center;
          margin-bottom: 15px;

          li {
            display: inline-block;
            border-right: 1px solid #e4e4e4;
            padding: 0 12px;
            margin: 15px 0;
            color: #007ddd;
            font-size: 12px;
            a:hover {
              color: blue;
              cursor: pointer;
            }
          }
          .last-border {
            border-right: none;
          }
        }
        .icon {
          text-align: center;
          span {
            margin: 0 25px;
            font-size: 20px;
          }
        }
      }
    }
  }
}
.error-msg {
  // position: absolute;
  top: 100%;
  left: 495px;
  color: red;
}
</style>
